#include <iostream>

using namespace std;


class CA{
public:
	~CA(){
		cout << "Destructor: CA" << endl;
	}

	void f(){}
};

class CB : public CA{
public:
	~CB(){
		cout << "Destructor: CB" << endl;
	}
	
	// virtual void f(){}
};

class CC : public CB{
public:
	~CC(){
		cout << "Destructor: CC" << endl;
	}	
};

void test(int arr[]){
	cout << "arr: " << arr << ", &arr: " << &arr << endl;
	cout << "sizeof(arr): " << sizeof(arr) << endl;

	for(int i = 0; i < 5; ++i)
		cout << "arr[" << i << "]: " << arr[i] << ", ";
	cout << endl;

	arr[4] = 10101;

	arr = new int [5];
	*arr = 10101;

}

void test(int (&arr)[5], bool b){ //void test(int (&arr)[]), Error C2265: 'abstract declarator' : reference to a zero-sized array is illegal
	cout << "arr: " << arr << ", &arr: " << &arr << endl;
	cout << "sizeof(arr): " << sizeof(arr) << endl;

	for(int i = 0; i < 5; ++i)
		cout << "arr[" << i << "]: " << arr[i] << ", ";
	cout << endl;
	int a[5];
	/// arr =a;
	arr[4] = 11;

	// arr = new int [5]; // Error	C2440: '=' : cannot convert from 'int *' to 'int [5]'
	*arr = 10101;
}

int vdmain(){
	cout << "sizeof(CA): " << sizeof(CA) << ", sizeof(CB): "  << sizeof(CB) << ", sizeof(CC): " << sizeof(CC) << endl;
	CA *ca = new CC();
	delete ca;

	cout << endl << endl;

	CB *cb = new CC();
	delete cb;

	cout << endl << endl;
	int arr[] = {1, 2, 3, 4, 5};

	cout << "arr: " << arr << ", &arr: " << &arr << endl;
	cout << "sizeof(arr): " << sizeof(arr) << endl;

	test(arr); // More than one instance of overload funcion "test" matches the arguemnt list
	test(arr, false);


	for(int i = 0; i < 5; ++i)
		cout << "arr[" << i << "]: " << arr[i] << ", ";
	cout << endl;

	return 0;
}